package com.example.doctor.jpa;

import com.example.common.entity.Hquestion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface HquestionRepository extends JpaRepository<Hquestion,Long> {

    @Query(value = "SELECT * FROM h_question WHERE t_id_bigint =?1",nativeQuery = true)
    List<Hquestion> findByTId(Long tid);

    @Modifying
    @Transactional
    @Query(value = "DELETE FROM h_question WHERE t_id_bigint=?1",nativeQuery = true)
    void deleteByTid(Long tid);
}
